package com.dcy.znoa.common.enums;

/**
 * Created by pengyu on 2017/10/6.
 */
public enum SexCode {
    //0：未知；1：男；2：女；3：其他
    UNKNOWN(0, "未知"),
    MAIL(1, "男"),
    FEMALE(2, "女"),
    OTHER(3, "其他");

    private Integer code;
    private String msg;

    private SexCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static  String getMsgByCode(Integer code) {
        switch (code.intValue()) {
            case 0:
                return UNKNOWN.getMsg();
            case 1:
                return MAIL.getMsg();
            case 2:
                return FEMALE.getMsg();
            case 3:
                return OTHER.getMsg();
            default:
                return null;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static  void main(String args[]){
        System.out.println(getMsgByCode(2));

    }

}

